﻿using OccurrencesCore.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace OccurrencesCore.Repository
{
    public partial class OccurrenceReasonRepository
    {
        /// <summary>
        /// Get all the reasons by occurrence type
        /// </summary>
        /// <returns>A list of reasons</returns>
        public List<OccurrenceReason> FindByType(int typeId)
        {
            return _Repository.Where(reason => reason.OccurrenceReasonOccurrenceType.Any(type => type.OccurrenceTypeId == typeId && type.Active)).ToList();
        }
    }
}
